package com.kfm.proxy;

import com.kfm.dao.AccountDao;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.sql.Connection;
import java.util.HashMap;
import java.util.Map;

public class StaticProxy {

    public static void main(String[] args) {
//        Kun kun = new Kun();
//        // 代理对象
//        IKun iKun = new IKun(kun);
//
//
//        iKun.sing(10000.0);
//
//        iKun.jump(10000.0);

    }
}


interface Actor {

    void sing(double money);

    void jump(double money);

}

class Kun implements Actor{

    @Override
    public void sing(double money) {
        System.out.println("收了 "+ money + "元， 唱了一首 鸡你太美");
    }

    @Override
    public void jump(double money) {
        System.out.println("收了 "+ money + "元，跳 《情人》 舞蹈");
    }
}

// 代理类
class IKun implements Actor{

    private Actor actor;

    public IKun(Actor actor){
        this.actor = actor;
    }

    @Override
    public void sing(double money) {
        System.out.println("收到了" + money + "元");
        System.out.println("我给你唱一首 鸡你太美");
//        actor.sing(money * 0.6);
    }

    @Override
    public void jump(double money) {
        System.out.println("收到了" + money + "元");
        actor.sing(money * 0.8);
    }
}
